<?php

Yii::import('common.models._base.BaseClassType');

class ClassType extends BaseClassType {

    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

    public function rules() {
        return array(
            array('name,status', 'required'),
            array('status, create_time, update_time', 'numerical', 'integerOnly' => true),
            array('name, photo', 'length', 'max' => 45),
            array('name, photo, status, create_time, update_time', 'default', 'setOnEmpty' => true, 'value' => null),
            array('id, name, photo, status, create_time, update_time', 'safe', 'on' => 'search'),
             array('photo,', 'file', 'allowEmpty' => false,'on' =>'insert',
                'types' => 'jpg, jpeg,gif,png',
                'maxSize' => 1024 * 1024 * 1, // 1MB
                'tooLarge' => 'The file was larger than 1MB. Please upload a smaller file.'),
        );
    }
     public static function label($n = 1) {
        return Yii::t('app', 'Class Type|Class Types', $n);
    }
      public function attributeLabels() {
        return array(
            'id' => Yii::t('app', 'ID'),
            'name' => Yii::t('app', 'Class Type Name'),
            'photo' => Yii::t('app', 'Photo'),
            'status' => Yii::t('app', 'Status'),
            'create_time' => Yii::t('app', 'Create Time'),
            'update_time' => Yii::t('app', 'Update Time'),
            'classes' => null,
        );
    }

}